<?php

namespace app\payment\model;

use app\payment\model\App as AppModel;
use think\Model;

/**
 * 模拟退款订单模型
 */
class RefundSimulationNotify extends Model
{

    // 设置当前模型对应的完整数据表名称
    protected $name = 'payment_order_refund_simulation_notify';
    // 主键
    protected $pk = 'order_id';
    // 自动写入时间戳
    protected $autoWriteTimestamp = false;

    /**
     * 获取应用名称
     * @param  array $app_id 应用id
     * @return mixed
     */
    public static function appName($app_id = '')
    {
        return AppModel::where(['id' => $app_id])->value('app_name');
    }

    /**
     * 获取应用id和名称
     * @param  array $merchant_id 应用id
     * @return mixed
     */
    public static function appidName($merchant_id = '')
    {
        $map = $merchant_id ? ['merchant_id' => $merchant_id] : [];
        return AppModel::where($map)->column('app_name', 'id');
    }
}
